package chaozuo;

import bbb.Booklist;

import java.awt.print.Book;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 18128
 * Date: 2023-09-25
 * Time: 21:45
 */
public class shanchu implements ZG{
    public void work(Booklist bookl)
    {
        System.out.println("输入你要删除的图书名字");
        Scanner sss=new Scanner(System.in);
        String nnn=sss.next();
        int fff=-1;
        for (int i = 0; i < bookl.getNums(); i++) {
            if(bookl.getBrr()[i].getName().equals(nnn))
            {
                fff=i;
                break;
            }
        }
        if(fff==-1)
        {
            System.out.println("没有你要删除的书");
            return;
        }
        for (int i = fff; i < bookl.getNums()-1; i++) {
            bookl.getBrr()[i]=bookl.getBrr()[i+1];
        }
        bookl.setNums(bookl.getNums()-1);

        System.out.println("删除图书成功");

    }
}
